package com.shop.trade.atom.atomsvc.impl;

import com.shop.common.model.ServiceBean;
import com.shop.common.model.param.trade.SnapshotInput;
import com.shop.common.model.result.trade.SnapshotOutput;
import com.shop.common.tmpl.BaseService;
import com.shop.trade.atom.atomsvc.ISnapshotAtomSvc;
import com.shop.trade.atom.dao.SnapshotMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description:
 *
 * @author zhoulk
 * @date: 2019年04月15日  0:17
 */
@Service
public class SnapshotAtom extends BaseService implements ISnapshotAtomSvc {
    @Autowired
    SnapshotMapper snapshotMapper;

    @Override
    public ServiceBean<Integer> addSnapshot(SnapshotInput snapshotInput) {
        Integer i = snapshotMapper.insertSelective(snapshotInput);
        if (opSuccess(i)) {
            return resultData(i);
        }
        return resultFailed();
    }

    @Override
    public ServiceBean<SnapshotOutput> qrySnapshot(SnapshotInput snapshot) {
        SnapshotOutput snapshotOutput = snapshotMapper.qrySnapshot(snapshot);
        if (snapshotOutput != null) {
            return resultData(snapshotOutput);
        }
        return resultFailed();
    }
}
